const fs = require("fs");
const events = require("events");
//实例化
let eventEmitter = new events.EventEmitter();
//判断谁先执行
console.log(1);


function getMime() {
    //异步读物文件
    fs.readFile("./mime.json", function (error, data) {
        if (error) {
            console.log(error)
        }
        eventEmitter.emit("data", data);
    });
}

getMime();

//监听广播事件
eventEmitter.on("data", function (mime) {
    console.log(mime.toString());
});
